<?php
$line = 1;
while($line<=5){
    $empty_position=$star_position=1;
    $empty_number=5-$line;
    $star_number=2*$line-1;
    while($empty_position<=$empty_number){
        echo'&nbsp;';
        ++$empty_position;
    }
    while($star_position<=$star_number){
        echo'*';
        ++$star_position;
    }
    echo'<br>';
    ++$line;
}
?>